{extend name="platform/base" /}
{block name="main"}
<section class="panel panel-default">
	<header class="panel-heading font-bold"> 基本设置 </header>
	<div class="panel-body">
	<form class="form-horizontal" id="form" name="form">
		<div class="form-group">
                                            <label class="col-sm-2 control-label">是否开启三级分销</label>
                                            <div class="col-sm-4">
                                                <label class="switch">
                                                    <input id="is_distribution_enable" type="checkbox" {eq name="shop_config_info.is_distribution_enable" value="1"}checked{/eq}>
                                                    <span></span> </label>
                                            </div>
                                        </div>
                                        
			<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
                                            <label class="col-sm-2 control-label">推广员申请是否需要审核</label>
                                            <div class="col-sm-4">
                                                <label class="switch">
                                                    <input id="is_distribution_audit" type="checkbox" {eq name="shop_config_info.is_distribution_audit" value="1"}checked{/eq}>
                                                    <span></span> </label>
                                            </div>
                                        </div>
          <div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-2">
					<a href="javascript:void(0);" onclick="modifyShopConfigIsDistribution()" class="btn btn-primary">保存</a>
				</div>
			</div>                              
	</form>
	</div>
</section>
<script>		
function modifyShopConfigIsDistribution(){
	if($("#is_distribution_enable").prop("checked")){
		var is_open = 1;
	}else{
		var is_open = 0;
	}
	if($("#is_distribution_audit").prop("checked")){
		var is_audit = 1;
	}else{
		var is_audit = 0;
	}
	$.ajax({
		type:"post",
		url:"PLATFORM_MAIN/Distribution/modifyShopConfigIsDistributionOrPromoterIsAudit",
		data:{
			'is_open':is_open,
			'is_audit':is_audit
		},
		async:true,
		success:function (data) {
			//alert(data);
			if (data["code"] > 0) {
				showMessage('success', data["message"],"PLATFORM_MAIN/Distribution/threeLevelDistributionConfig");
			}else{
				showMessage('error', data["message"]);
			}	
		}
	});
}
</script>
{/block}